package cn.lizemin.fakedata.converter;

import cn.lizemin.fakedata.project.elementUi.VO.ElementUserVO;
import cn.lizemin.fakedata.project.elementUi.entity.ElementUser;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 李泽民
 * @Date 2024/1/25 18:29
 * @Description
 */
public class ElementUserConverter {

    public static List<ElementUserVO> toElementUserVos(List<ElementUser> users) {
        if (users == null) {
            users = new ArrayList<>();
        }
        return users.stream().map(user -> {
            ElementUserVO userVO = new ElementUserVO();
            BeanUtils.copyProperties(user, userVO);
            return userVO;
        }).collect(Collectors.toList());
    }

}
